efform_onload = function ()
{
	$('#flag').val()==4
//	if($('#flag').val()==4)
//	{
//	   document.getElementById('ef_region_inqu').style.display = "none";
//	}
};  


button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCG84","query");
}
button_update_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="未发布")
		{
			EFAlert("只能对未发布的记录进行修改！"); return;
		}
	}
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","update",true);
	
//	EFConfirm('你确认要修改吗?', '确认框', function(r) {
//		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","update",true);
//	}); 
	
	
//	if (isSelected("ef_grid_result") == 0)
//		return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","update",true);
}
button_insert_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="未发布")
		{
			EFAlert("只能对未发布的记录进行新增！"); return;
		}
	}
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","insert",true);
	
//	EFConfirm('你确认要新增吗?', '确认框', function(r) {
//		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","insert",true);
//	}); 
	
//	if (isSelected("ef_grid_result") == 0)
//		return; 
//	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","insert",true);
}

button_delete_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	for(var i=0;i<rows.length;i++)
	{
		if(grid.getCellValueByColumnName(rows[i],"fdStatus")!="未发布")
		{
			EFAlert("只能对未发布的记录进行删除！"); return;
		}
	}
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","delete",true);
	}); 
}

button_report_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	EFConfirm('确认要上报吗?', '确认框', function(r) {
		efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","report",true);
	});
}
button_goback_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	EFConfirm('确认要撤回吗?', '确认框', function(r) {
		efgrid.submitForm( "ef_grid_result", "ZM","ZMCG84","goback",true);
	});
}

efgrid_afterAddNewRow = function(grid_id) {
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();
	if (grid_id == "ef_grid_result") {
		for (var i = 0; i < rows.length; i++) {
			
			grid.setCellValue(rows[i], 0, "未发布", TYPE_DATA);			
		}
	}
}

//efgrid_afterAddNewRow = function(grid_id) {
//	var userId = $('#userId').val();
//	var userName = $('#userName').val();
//	var departmentId = $('#departmentId').val();
//	var departmentName = $('#departmentName').val();
//	var mineParameter = $('#mineParameter').val();
//	 
//	var grid = efgrid.getGridObject(grid_id);
//	var rows = grid.getCheckedRows();
//	if (grid_id == "ef_grid_result") {
//		for (var i = 0; i < rows.length; i++) {
//			
//			grid.setCellValue(rows[i], 3, departmentName, TYPE_DATA);
//			grid.setCellValue(rows[i], 4, userName, TYPE_DATA);
//			grid.setCellValue(rows[i], 5, userId, TYPE_DATA);
//			grid.setCellValue(rows[i], 6, departmentId, TYPE_DATA);
//			
//		}
//	}
//}
